#!/usr/bin/python
# -*- coding:utf-8 -*-
# 地精排序
#@author: wklken@yeah.net

def gnome_sort(l):
    
    size = len(l)
    i = 0
    while i < size:
        if i == 0 or l[i-1] < l[i]:
            i += 1
        else:
            l[i-1], l[i] = l[i], l[i-1]
            i -=1
        print "one time",l 
 
l = [8, 4, 3, 7, 6, 5, 2, 1]
gnome_sort(l)      